#ifndef SERVER_H
#define SERVER_H

#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include <QDebug>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QMessageBox>
#include <QTimer>
#include <QFile>
//#include <QByteArray>

namespace Ui {
class Server;
}

class Server : public QWidget
{
    Q_OBJECT

public:
    explicit Server(QWidget *parent = 0);
    ~Server();

    void startServer();
    void onReadyRead();
    void onNewConnection();

private:
    Ui::Server *ui;
    QSqlDatabase db;
    QTcpServer *tcpServer;
    quint16 port;
    QList<QTcpSocket*> tcpClientList;
    QHostAddress ip;
    QTimer *timer;

};

#endif // SERVER_H
